package com.ticket.sass.admin.dto.input.commodity;

import com.ticket.sass.admin.validator.InEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author ywb
 * @date 2024-03-23 14:17
 */
@Data
@ApiModel(value = "卖品 SKU", description = "按照要求填写")
public class CommoditySkuInput {
    private Long id;
   
    @Valid
    @Size(max = 1, message = "封面图最多一张")
    @ApiModelProperty(value = "封面图", required = true)
    private List<@NotBlank(message = "封面图不能为空") String> cover = new ArrayList<>();
    
    @Digits(integer = 6, fraction = 2, message = "售价格式不正确，应为不超过6位整数和2位小数的数值")
    @NotNull(message = "售价不能为空")
    @ApiModelProperty(value = "卖品售价", required = true)
    private BigDecimal salePrice;
    
    @Digits(integer = 6, fraction = 2, message = "原价格式不正确，应为不超过6位整数和2位小数的数值")
    @NotNull(message = "原价不能为空")
    @ApiModelProperty(value = "卖品市场价")
    private BigDecimal marketPrice;
    
    @ApiModelProperty(value = "库存", required = true)
    private Integer stockNum = 0;
    
    @InEnum(intValues = {0, 1})
    @ApiModelProperty(value = "发布状态：0 未发布，1已发布")
    private Integer publishStatus = 1;
    
    @ApiModelProperty(value = "外部sku编码")
    private String externalCode;
    
    @ApiModelProperty(value = "属性值对 示例 {  " +
        "  \"分量\": \"大杯\",  " +
        "  \"温度\": \"标准冰\",  " +
        "  \"甜度\": \"很甜\"  " +
        "} ", required = true)
    private Map<String, String> attrMap;
}
